import { ref } from 'vue';
import DepartmentContent from '@/views/main/system/department/children/department-content.vue';

function usePageContent() {
  const contentRef = ref<InstanceType<typeof DepartmentContent>>();
  /**
   * @function handleSearchReset search组件中的重置按钮点击事件
   */
  function handleSearchReset() {
    contentRef.value?.fetchPageListData();
  }

  /**
   * @function handleSearchQuery search组件中的查询按钮点击事件
   * @param queryInfo 查询参数
   */
  function handleSearchQuery(queryInfo: any) {
    contentRef.value?.fetchPageListData(queryInfo);
  }

  return {
    contentRef,
    handleSearchReset,
    handleSearchQuery
  };
}

export default usePageContent;
